package com.bobo.consumer;


import com.bobo.api.BoboApi;
import org.apache.servicecomb.provider.pojo.RpcReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Create By zdw on 2019/6/24
 * @author bobo
 */
@RequestMapping("/rpc")
@RestController
public class RpcConsumerController {

    /**
     * 通过Rpc协议远程调用rest协议的接口，
     * microserviceName是微服务提供者的名称，在服务提供者的microservice.yaml文件中配置的service_description:name
     * schemaId是微服务提供者的schemaId，在服务提供者的controller定义的时候有
     */
    @RpcReference(microserviceName = "bobo-provider", schemaId = "boboApi")
    BoboApi boboApi;
 
    @GetMapping("/request")
    public String sayHello(String name){
        return boboApi.sayHello(name);
    }

    @GetMapping("/request2")
    public String sayHello2(String name){
        return boboApi.sayHello(name);
    }

    @GetMapping("/request3")
    public String sayHello3(String name){
        return boboApi.sayHello(name);
    }

    @GetMapping("/request4")
    public String poo(String color){
        return boboApi.poo(color);
    }
}